home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / PIXELWOR / ABOUT_CP.IXE < prev    next >
Text File  |  1992-01-01  |  7KB  |  131 lines

  1.  
  2. CPixelWorld, Version 1.0                                          (SUPERCLASS = CBitMap)
  3. ____________________________________________________________
  4.  
  5.     Ñ    Description
  6.         
  7.         The CPixelWorld class is a subclass of CBitMap (THINK Class Library 1.1) 
  8.         designed to maintain a color offscreen drawing environment using the 
  9.         standard conventions of Color QuickDraw.  An offscreen color graphics 
  10.         device (GDevice) and an offscreen color graphics port (CGrafPort) are 
  11.         used to maintain this offscreen world.  This implementation supports 
  12.         standard pixel depths of 1,2,4 and 8 bits.  Pixel depths of 16 and 32 
  13.         are not supported since this implementation does not rely on 32-Bit 
  14.         QuickDraw features.  In the future, support for 16 and 32 bit pixel 
  15.         depths and the offscreen GWorlds provided by 32-Bit QuickDraw can be 
  16.         incorporated into a subclass of CPixelWorld called CGWorld.  
  17.         
  18.     Ñ    Creating a Blank Pixel World
  19.         
  20.         A blank pixel world is created by calling the initialization method 
  21.         IPixelWorld() with a pixel depth (aPixelDepth), a bounds rectangle 
  22.         (aBoundsRect), a handle to a color table (aColorTable), and NULL for 
  23.         the handle to the pixel image (aPixelImage).  You can pass any value 
  24.         for row bytes (aRowBytes) since the value will be ignored in this case.  
  25.         You should pass a color table handle (CTabHandle) in the aColorTable 
  26.         parameter.  The color table is copied and the copy is used for the 
  27.         offscreen world.  If aColorTable is NULL, then the default color table 
  28.         for the desired pixel depth will be used.  
  29.         
  30.                                        *** WARNING ***
  31.         
  32.         If you request a pixel depth of one and Color QuickDraw is not 
  33.         available, then a blank offscreen world will be created as a standard 
  34.         BitMap with a non-color graphics port (GrafPort) using the CBitMap 
  35.         superclass.  If you request a pixel depth greater than one and Color 
  36.         QuickDraw is not available, the initialization method will fail.  To 
  37.         detect initialization failure call the method WorldIsOK(), which 
  38.         returns the value of the instance variable worldIsOK.  WorldIsOK() 
  39.         will return TRUE after successful initialization, and FALSE after 
  40.         initialization failure.  
  41.         
  42.     Ñ    Creating a Pixel World with an Existing Image
  43.         
  44.         A world based on an existing color or grayscale image is created by 
  45.         calling the initialization method IPixelWorld() with the pixel depth of 
  46.         the existing image (aPixelDepth), the bounds rectangle of the existing 
  47.         image (aBoundsRect), a color table for the existing image (aColorTable), 
  48.         and a handle to the pixels for the existing image (aPixelImage).  In 
  49.         this case, you must also pass a value for the row bytes of the pixel 
  50.         image (aRowBytes).  
  51.         
  52.                                        *** IMPORTANT ***
  53.         
  54.         When you create an offscreen world based on an existing pixel image, 
  55.         IT IS YOUR RESPONSIBILITY TO DISPOSE OF YOUR PIXEL IMAGE.  Although 
  56.         CPixelWorld keeps its own handle to your pixel image in the instance 
  57.         variable worldPixels, it will not dispose of the pixel image.  In 
  58.         contrast, when you create a blank world by passing NULL for the 
  59.         aPixelImage parameter, CPixelWorld creates its own pixel image and it 
  60.         will dispose of this image when the offscreen world is destroyed by 
  61.         the Dispose() instance method.  
  62.         
  63.         When you create your own pixel image for use with an offscreen world 
  64.         use a multiple of four for the row bytes of your pixel image.  The 
  65.         following formula will give a multiple of four for row bytes:  
  66.         
  67.             rowBytes = ((((long) width * pixelDepth) + 31) / 32) * 4;
  68.         
  69.         A multiple of four for row bytes will give optimal performance in calls 
  70.         to the QuickDraw function CopyBits() and its related functions.  
  71.         
  72.                                        *** WARNING ***
  73.         
  74.         When you create an offscreen world with an existing image that has a 
  75.         pixel depth greater than one, the initialization method will fail if 
  76.         Color QuickDraw is not available since there is no support for images 
  77.         with pixel depths greater than one without Color QuickDraw.  
  78.         
  79.     Ñ    Drawing to the Offscreen Pixel World
  80.         
  81.         If you need to draw directly to the offscreen world, you must bracket
  82.         all drawing with calls to BeginDrawing() and EndDrawing().  This will 
  83.         set up the offscreen GDevice and CGrafPort for drawing.  In addition, 
  84.         the LockWorldPixels() method will be called to make sure that the 
  85.         pixel image is anchored down and will not move when you invoke any 
  86.         QuickDraw routines.  LockWorldPixels() locks the handle to the pixel 
  87.         image, and then it loads the derefernced handle into the PixMap 
  88.         baseAddr pointers of both the offscreen GDevice and the offscreen 
  89.         CGrafPort.  
  90.         
  91.     Ñ    Version History
  92.         
  93.          _________________________________________________
  94.              Release Version:           1.0
  95.          Release Date:                January 1, 1992
  96.          
  97.            Implemented By:            Vincent R. Vann, Jr.
  98.                                               1901 Brickell Ave, B-410
  99.                                               Miami, Florida  33129  USA
  100.  
  101.             Compuserve Address:       76530,1242
  102.              Internet Address:          vvann@umbio.med.miami.edu
  103.                                                (129.171.65.204)
  104.          _________________________________________________
  105.   
  106.     Ñ    License Agreement
  107.         
  108.         All portions of this source code are property of Vincent R. Vann, Jr.
  109.         I, Vincent R. Vann, Jr., grant you the right to freely distribute this 
  110.         source code and to use all or part of this source code in all software  
  111.         including commercial, freeware, shareware and private applications.  
  112.         However, all software that uses any part of or all of this source code 
  113.         must display a copyright notice indicating that either all of or 
  114.         portions of this source code are used in the software.  I also grant 
  115.         you permission to alter and make improvements to this source code, but 
  116.         only if all modifications are returned to me by whatever means are 
  117.         available, either in written or electronic form.  You must also accept 
  118.         that I retain the right to include any part of your modifications or 
  119.         all of your modifications in future releases of this source code.  The 
  120.         description and version history sections above may be ammended for 
  121.         documentation purposes.  This license agreement and the copyright 
  122.         notice below must be maintained intact and must be included with all 
  123.         distributions of this source code at all times.  
  124.         
  125.         This implementation is based in part on material copyrighted by Apple 
  126.         Computer, Inc. and Symantec Corporation.  
  127.         
  128.         Copyright ⌐ 1992 Vincent R. Vann, Jr.  All rights reserved.  
  129. ____________________________________________________________
  130.  
  131.